import jwt


class MyJwt:
    def __init__(self):
        self.seckey = "werhiqpWEFHP870029-329290**(*^&@^@^enalwndpa"

    def jwt_encode(self, data):
        return jwt.encode(data, self.seckey, algorithm="HS256")

    def jwt_decode(self, token):
        return jwt.decode(token, self.seckey, algorithms="HS256")

    def check(self, token):
        try:
            payload = jwt.decode(token, self.seckey, algorithms="HS256")
            newtoken = jwt.encode(payload, self.seckey, algorithm="HS256")
            if token == newtoken:
                token_time = payload['time']
                return True
        except Exception as a:
            return False


jj = MyJwt()
